package com.cskaoyan.bean;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author stone
 * @date 2022/11/15 21:13
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BaseRespVo <T>{
    // 将该类的实例转换为Json字符串过程中，
    // 如果该成员变量的值的类型是Date类型的值，按照该注解的pattern属性值指定的格式做转换
    @JsonFormat(pattern = "yyyy/MM/dd",timezone = "GMT+8")
    T data;
    String msg;
    int status;


    public static <T> BaseRespVo ok(T data){
        return new BaseRespVo(data, "成功", 200);
    }
    public static BaseRespVo ok(){
        return new BaseRespVo(null, "成功", 200);
    }
    public static BaseRespVo fail(){
        return new BaseRespVo(null, "失败", 500);
    }
}
